import { defineStore } from 'pinia'
import { markRaw } from 'vue'
import { subLineData as mockSubLineData } from './staticData.js'

export const useLineStore = defineStore('line', {
  state: () => ({
    viewer: null, // Cesium Viewer实例
    lineData: [], // 线路数据
    subLineData: mockSubLineData, // 线路按钮数据
    currentStations: [], // 当前线路站点
  }),
  actions: {
    setViewer(viewer) {
      this.viewer = markRaw(viewer)
    },
    setLineData(data) {
      this.lineData = data
    },
    setCurrentStations(stations) {
      this.currentStations = stations
    },
  },
})
